<template>
	<view class="body">
		<view class="content">
			<view class="title">
				团队累计消费订单{{obj.count}}单 <text class="all">累计消费金额{{obj.price}}</text>
			</view>
			<view class="list" v-for="(item,index) in orderList" :key="index">
				<view class="flex">
					<u-image shape="circle" width="80rpx" height="80rpx" :src="item.saas_user?item.saas_user.avatar:''"></u-image>
					<view class="right">
						<view class="name">
							{{item.saas_user?item.saas_user.name:''}}
						</view>
						<view class="fen">
							{{item.team_bonus_leader_level_name}}
						</view>
					</view>
				</view>
				<view class="flex_bw">
					<view class="next">
						累计消费订单<text class="order">{{item.teamOrderPrice.count}}</text>
					</view>
					<view class="next">
						累计消费金额<text class="money">{{item.teamOrderPrice.price}}</text>
					</view>
				</view>
			</view>
		</view>
		<view style="padding:30rpx 0rpx 0rpx ">
			<u-loadmore :status="noMore ? 'nomore': 'loadmore'" />
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				noMore: false,
				page: 1,
				orderList: [],
				limit: 10,
				obj:{}

			}
		},
		onLoad() {
			this.getList();
		},
		onReachBottom() {
			console.log('我出发了')
			this.getList(true);
		},
		methods: {
			async getList(isBottom) {
				// 已经到底
				if (this.noMore) return
				// 触底更新数据
				if (isBottom) {
					this.page++
				}
				const res = await this.$allrequest.teamCenter.myContent({
					page: this.page,
					limit: this.limit
				});
				if (res.code == 0) {
					this.obj=res.teamOrderPrice
					this.orderList.push(...res.data.list)
					this.noMore = res.data.totalCount <= this.page * this.limit
				}
			},
		}
	}
</script>

<style scoped lang="scss">
	.body {
		width: 750rpx;
		min-height: 100vh;
		background: #F2F2F2;
		padding-top: 1rpx;
		padding-bottom: 30rpx;
	}

	.content {
		width: 702rpx;
		background: #FFFFFF;
		border-radius: 20rpx;
		margin: 24rpx auto 0rpx;
		padding: 24rpx 16rpx;

		.title {
			padding: 24rpx 0rpx 24rpx 24rpx;
			width: 670rpx;
			background: linear-gradient(180deg, #FFF4E7 0%, #FFF9F4 100%);
			border-radius: 10rpx;
			font-weight: 400;
			font-size: 24rpx;
			color: #582F1C;

			.all {
				color: #F0250E;
				padding-left: 10rpx;
			}
		}

		.list {
			padding: 24rpx;
			margin-top: 10rpx;
			background: #FAFAFA;

			.flex {
				display: flex;
				align-items: center;

				.right {
					margin-left: 20rpx;

					.name {
						font-weight: 400;
						font-size: 28rpx;
						color: #262626;
					}

					.fen {
						font-weight: 400;
						font-size: 24rpx;
						color: #8C8C8C;
						margin-top: 6rpx;
					}
				}
			}

			.flex_bw {
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-top: 30rpx;

				.next {
					font-weight: 400;
					font-size: 24rpx;
					color: #8C8C8C;

					.order {
						font-weight: 600;
						font-size: 30rpx;
						color: #262626;
						margin-left: 10rpx;
					}

					.money {
						font-weight: 600;
						font-size: 30rpx;
						color: #F0250E;
						margin-left: 10rpx;
					}
				}
			}
		}
	}
</style>